#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

vector<string> findRepeatedDnaSequences(string s) {
    vector<string> ans;
    if (s.length() < 10) return ans;
    unordered_map<string, int> mymap;
    for (int i = 0; i <= s.length() - 10; i++) {
        string str = s.substr(i, 10);
        auto it = mymap.find(str);
        if (it != mymap.end())
            it->second++;
        else
            mymap.insert(make_pair(str, 1));
    }
    for (auto it = mymap.begin(); it != mymap.end(); it++) {
        if (it->second > 1) {
            ans.push_back(it->first);
        }
    }
    return ans;
}

int main() {
    cout << "hello world" << endl;
    string s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT";
    vector<string> ans = findRepeatedDnaSequences(s);
    for (auto iter = ans.begin(); iter != ans.end(); iter++) {
        cout << *iter << endl;
    }
}